home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 September (IDG) / Sep99.iso / Shareware World / Comms & Internet / LinkConverter 1.1.2 / Dialog Director v0.7 / Examples / FMP Layouts.as < prev    next >
Encoding:
Text File  |  1998-02-08  |  2.6 KB  |  75 lines  |  [TEXT/ToyS]

  1. on SmallMenuItem(n, icn, aName)
  2.     set x to 10 + (n - 1) mod 2 * 180
  3.     set y to (n - 1) div 2 * 24 + 7
  4.     return [{class:icon push button, bounds:[x, y, x + 22, y + 22], contents:icn, style:9}, ¬
  5.         {class:static text, bounds:[x + 26, y + 3, x + 178, y + 19], contents:aName}]
  6.     --{class:push button, bounds:[x + 26, y + 1, x + 150, y + 21], name:aName}]
  7. end SmallMenuItem
  8.  
  9. on SmallChooseLayout()
  10.     --try
  11.     tell application "FileMaker Pro" to tell document 1
  12.         set docName to name
  13.         set layoutNames to name of every layout
  14.         set layoutCount to layoutNames's length
  15.         set theContents to []
  16.         repeat with i from 1 to layoutCount
  17.             set theContents to theContents & my SmallMenuItem(i, 128, layoutNames's item i)
  18.         end repeat
  19.         
  20.         activate
  21.         set n to dd auto dialog {style:standard window, has close box:true, default item:0, name:docName ¬
  22.             , size:[380, 12 + 24 * ((layoutCount + 1) div 2)], contents:theContents} with fonts {style:32} with grayscale
  23.         repeat with i from 1 to layoutCount * 2 by 2
  24.             if n's item i then
  25.                 go to layout (layoutNames's item ((i + 1) div 2))
  26.                 exit repeat
  27.             end if
  28.         end repeat
  29.     end tell
  30.     (*on error
  31.         beep
  32.     end*)
  33. end SmallChooseLayout
  34.  
  35. on BigMenuItem(n, icn, aName, aDesc)
  36.     set y to n * 45 - 35
  37.     return [{class:icon push button, bounds:[20, y, 20 + 40, y + 40], contents:icn, style:8}, ¬
  38.         {class:static text, bounds:[70, y - 1, 320, y + 15], contents:aName, font:1}, ¬
  39.         {class:static text, bounds:[70, y + 14, 320, y + 14 + 24], contents:aDesc}]
  40. end BigMenuItem
  41.  
  42. on BigChooseLayout()
  43.     --try
  44.     set f to path to me
  45.     tell application "FileMaker Pro" to tell document 1
  46.         set [docName, layoutNames] to [name, name of every layout]
  47.         
  48.         set layoutCount to layoutNames's length
  49.         if layoutCount > 6 then set layoutCount to 6
  50.         set theContents to []
  51.         repeat with i from 1 to layoutCount
  52.             set theContents to theContents & my BigMenuItem(i, i * 1000, layoutNames's item i, ¬
  53.                 "Put description for layout “" & layoutNames's item i & "” of database “" & docName & "” here.")
  54.         end repeat
  55.         
  56.         activate
  57.         set rf to res open f with keep in chain -- If saved as an applet this will use the icons in its res fork
  58.         set n to dd auto dialog {style:standard window, has close box:true, name:docName & " - Choose a Layout", size:[340 ¬
  59.             , 15 + layoutCount * 45], contents:theContents} with fonts [null, null, {name:"Geneva", size:9, style:italic}] with grayscale
  60.         res close rf
  61.         repeat with i from 1 to layoutCount * 3 by 3
  62.             if n's item i then
  63.                 go to layout (layoutNames's item ((i + 2) div 3))
  64.                 exit repeat
  65.             end if
  66.         end repeat
  67.     end tell
  68.     (*on error
  69.         beep
  70.     end try*)
  71. end BigChooseLayout
  72.  
  73.  
  74. SmallChooseLayout()
  75. BigChooseLayout()